<?php
/******************************************
 * Author: <YOUR NAME HERE>
 * Description: <YOUR DESCRIPTION HERE>
 ******************************************/
class Countries  extends CustomSecurity { 

	var $db; 
	var $id;
	var $county;

	function Countries($db){ 
          $this->db = $db; 
    }

//	/***********************************
// 	 * Add:         Allows the insertion of values into the Table.
// 	 * Parameters:  $id, $county
// 	 * Return:      (Boolean) True - Successfully Inserted | False - Error
// 	 ************************************/
//	function add($id, $county){ 
//
//		escape_string($id);
//		escape_string($c);
//
//		$statement = "INSERT INTO countries (id, county) VALUES ('$id', '$county');";
//		$results   = $this->db->query($statement);
//
//		if($results){
//			return true;
//		}else{
//			return false;
//		}
//
//	}//End add()


//	/***********************************
// 	 * Remove:      Allows for the removal of record from the database.
// 	 * Parameters:  (String)Primary Key Column Name | (Int) Primary Key Value
// 	 * Return:      (Boolean) True - Successfully Removed | False - Error
// 	 ************************************/
//	function remove($primaryKeyName, $primaryKeyValue){ 
//
//		//Custom SQL Injection Escaping HERE
//
//		$statement = "DELETE FROM countries WHERE $primaryKeyName = '$primaryKeyValue'";
//		$results   = $this->db->query($statement);
//		if($results){
//			return true;
//		}else{
//			return false;
//		}
//
//	}//End remove()
//

//	/***********************************
// 	 * Update:      Allows for the update of a record from the database.
// 	 * Parameters:  (String)Primary Key Column Name | (Int) Primary Key Value | (String) Column Name To Update | (String) New Value
// 	 * Return:      (Boolean) True - Successfully Updated | False - Error
// 	 ************************************/
//	function update($primaryKeyName, $primaryKeyValue, $columnNameToUpdate, $columnValue){ 
//
//		//Custom SQL Injection Escaping HERE
//
//		$statement = "UPDATE countries SET $columnNameToUpdate = '$columnValue' WHERE $primaryKeyName = '$primaryKeyValue'";
//		$results   = $this->db->query($statement);
//		if($results){
//			return true;
//		}else{
//			return false;
//		}
//
//	}//End update()


	/***********************************
 	 * GetAll:       Returns all the records in the database.
 	 * Parameters:   NA
 	 * Return:      (MultiDimensional-Array)String
 	 ************************************/
	function getAll(){ 

		//Custom SQL Injection Escaping HERE

		$statement = "SELECT county, id  FROM countries ORDER BY county ASC";
		$results   = $this->db->getAll($statement);

		return $results;

	}//End getAll()
	
	function getCountry($id){
		$statement = "SELECT county  FROM countries where id=$id";
		$results   = $this->db->getAll($statement);

		return $results;
	}
	

//
//	/***********************************
// 	 * GetObject:   Returns a specific record form the batabase.
// 	 * Parameters:  (Int) Primary Key Value
// 	 * Return:      (Array)String
// 	 ************************************/
//	function getObject($primaryKeyName, $primaryKeyValue){ 
//
//		//Custom SQL Injection Escaping HERE
//
//		$statement = "SELECT id, county FROM countries WHERE ".$primaryKeyName." = '".$primaryKeyValue."'";
//		$results   = $this->db->getAll($statement);
//
//		return $results;
//
//	}//End getObject()


}//End Class Countries
?>